<?php
/**
 * <https://y.st./>
 * Copyright © 2018 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'No spores',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<img src="/img/CC_BY-SA_4.0/y.st./weblog/2018/11/29.jpg" alt="A Eugene street at night" class="framed-centred-image" width="649" height="480"/>
<section id="drudgery">
	<h2>Drudgery</h2>
	<p>
		My discussion post for the day:
	</p>
	<blockquote>
		<h3>Disclaimer</h3>
		<p>
			I&apos;ve described things from personal knowledge before in discussions, and people tend to jump down my throat about not citing my sources.
			Then I replay saying I didn&apos;t use sources and just typed what I already knew, and people tell me I should have said that from the beginning.
			So.
			Everything in this post is based on personal knowledge.
			I&apos;ve used both queues and stacks a multitude of times in the past, and have a decent understanding of what they are, how they operate, and what their differences are.
		</p>
		<h3>Queues and stacks</h3>
		<p>
			A queue is first in, first out ($a[FIFO]) data structure.
			That is to say, the first item you put in a queue will be the first item to leave the queue to be processed.
			Everything is processed in the order it arrives.
			You can think of it like standing in line at the grocery store.
			If you get to the line when it&apos;s empty, the checker scans your items right away, then you pay and leave.
			However, if the checker&apos;s helping someone else, you have to wait.
			The sooner you get to the line, the less people you have to stand behind and the sooner you&apos;ll be allowed to pay and leave.
			The checker doesn&apos;t randomly choose which person from the line they&apos;ll help next.
			Order of arrival is order of departure.
		</p>
		<p>
			A stack is a last in, first out ($a[LIFO]) data structure.
			When items are added to it, those items prevent older items from being processed.
			Basically, the newer the item is in the stack, the sooner it will be dealt with.
			A stack can be compared to ... well, a stack of paperwork.
			Imagine you have a stack of paperwork on your desk.
			You&apos;re not allowed to rearrange the papers or take any paper other than the top one.
			When adding to the stack, you&apos;re only allowed to place things on top.
			Whichever item is the oldest will never be processed unless <strong>*all*</strong> other items have already been processed.
			You&apos;d better hope this isn&apos;t a stack of bills!
			For bills, you&apos;d be better off using a queue so you don&apos;t end up paying them late.
		</p>
		<h3>Implementation</h3>
		<p>
			Stacks and queues can both be implemented in many ways.
			If I recall, a stack is much easier to implement in Java than a queue.
			Basically, each stack/queue item can be represented as an object, and each object holds a link to the next object in the structure.
			You only need to know the top stack item, so when a new item is added to the stack, the new item links to the formerly-top item, and the reference to the top of the stack is updated to hold a reference to the new item.
			When an item is removed from the stack, the link to the stack is updated to point to the same item the formerly-top item&apos;s link pointed to.
		</p>
		<p>
			For queues though, both ends of the structure are used: one for entry, and one for exit.
			you can either keep a link to each end, or you can traverse the structure every time when you need to use the end you didn&apos;t link to.
			Obviously, you can link to either end, but which end you link to will determine whether adding items or removing them will be more efficient.
		</p>
		<h3>Help with this week&apos;s assignment</h3>
		<p>
			This week&apos;s assignment includes the following:
		</p>
		<blockquote>
			<p>
				By the end of week on you must post your work to the Unit 3 Stack Development Assignment workshop link and solicit help or feedback from your peers.
			</p>
		</blockquote>
		<p>
			I couldn&apos;t find this workshop link for soliciting help or feedback in the learning guide or the assignment instructions.
			Where do we go for that?
			All I could find was the assignment submission link, which does not allow for asking for help, though I guess the grading is technically a form of feedback.
		</p>
	</blockquote>
</section>
<section id="Minetest">
	<h2>Minetest</h2>
	<img src="/img/CC_BY-SA_3.0/minetest.net./weblog/2018/11/29.png" alt="Iron ore underwater" class="framed-centred-image" width="800" height="600"/>
	<p>
		I forgot to mention yesterday that I found a mushroom on the island, but it didn&apos;t bear spores.
		If it had, I could have started up a mushroom colony once I got underground.
		That&apos;ll have to wait until I find more mushrooms now though.
	</p>
</section>
END
);
